#ifndef CONFIGMANAGER_H
#define CONFIGMANAGER_H

#include <QObject>
#include <QJsonObject>
#include <QJsonArray>
#include <QVector>
#include <QString>
#include <QVariant>

struct FilterConfig {
    QString name;
    QString type;
    QString field;
    QStringList options;
};

struct ColumnConfig {
    QString name;
    QString field;
    int width;
    bool filterable;
    QString filterType;
    QStringList filterOptions;
    bool sortable;
    bool interactive;
};

struct PaginationConfig {
    int defaultPageSize;
    QVector<int> pageSizeOptions;
};

class ConfigManager : public QObject
{
    Q_OBJECT
public:
    explicit ConfigManager(QObject *parent = nullptr);

    bool loadConfig(const QString &configPath);
    QVector<FilterConfig> getFilters() const;
    QVector<ColumnConfig> getColumns() const;
    PaginationConfig getPaginationConfig() const;

private:
    QVector<FilterConfig> m_filters;
    QVector<ColumnConfig> m_columns;
    PaginationConfig m_paginationConfig;

    bool parseFilters(const QJsonArray &filtersArray);
    bool parseColumns(const QJsonArray &columnsArray);
    bool parsePagination(const QJsonObject &paginationObject);
};

#endif // CONFIGMANAGER_H
